package yja.gzw.app.activity

import android.util.Log
import android.widget.Toast
import androidx.lifecycle.Observer
import com.bumptech.glide.Glide
import yja.gzw.app.R
import yja.gzw.app.base.BaseActivity
import yja.gzw.app.databinding.ActivityShengqingxiangqingBinding
import yja.gzw.app.model.UserData
import yja.gzw.app.viewmodel.Mainviewmodel

class ShengqingxiangqingActivity :BaseActivity<Mainviewmodel, ActivityShengqingxiangqingBinding>(R.layout.activity_shengqingxiangqing){
    override fun initView() {
        val intnr=intent.getStringExtra("idids")


        binding.fanhui.setOnClickListener {
            finish()
        }
        viewmodel.onshengqingxiangqingwang(UserData.token, mapOf("id" to intnr!!))


    }

    override fun dataObservese() {
        viewmodel.onshengqingxiangqing.observe(this, Observer {
            if(it.code==1){
                binding.zhuangtai.text=it.data.status_text
                binding.yuanying.text="原因："+it.data.remark
                val tutu=it.data.yy_images.split(",")
                Log.e("申请图",tutu[0])
                Glide.with(this).load("http://117ai.32.hzgqapp.com/"+tutu[0]).into(binding.tupian)

            }else{
                Toast.makeText(this,it.msg, Toast.LENGTH_SHORT).show()
            }

        })


    }
}